package com.health.listener;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class Listener4 {

    @RabbitListener(
            bindings = @QueueBinding(value = @Queue("队列1"),
            exchange = @Exchange(value = "交换机1",type = ExchangeTypes.DIRECT), key = {"tag1"}))
    public void show1(String msg){
        System.out.println("路由模式-队列1，消费信息："+msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(value = @Queue("队列2"),
                    exchange = @Exchange(value = "交换机1",type = ExchangeTypes.DIRECT),key = "tag2"))
    public void show2(String msg){
        System.out.println("路由模式-队列2，消费信息："+msg);
    }

}
